import { NHighlight, type HighlightProps } from "naive-ui";
import type { HTMLAttributes } from "vue";

export type HighlightFactoryConstructorType = {
  props?: HighlightProps;
  attrs?: HTMLAttributes;
};

export class HighlightFactory {
  private props: HighlightProps = {};
  private attrs: HTMLAttributes = {};

  constructor(data?: HighlightFactoryConstructorType) {
    if (data?.props) this.setProps(data.props);
    if (data?.attrs) this.setAttrs(data.attrs);
  }

  setProps(props: HighlightProps) {
    this.props = props;
    return this;
  }

  setAttrs(attrs: HTMLAttributes) {
    this.attrs = attrs;
    return this;
  }

  create() {
    return <NHighlight {...this.attrs} {...this.props}></NHighlight>;
  }
}
